home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / software / temacd / tiny / tpf-6[1].5.126.exe / Tiny Firewall 2005.msi / webui.dll / IDS / IDS-TOOLS.XSL < prev   
Encoding:
Extensible Markup Language  |  2005-08-17  |  8.6 KB  |  131 lines

  1.  ■<?xml version="1.0"?>
  2. <!--
  3. /*//////////////////////////////////////////////////////////////////////
  4. Filename:          ids-tools.xsl
  5. Company Name:      Computer Associates International, Inc.
  6. Legal Copyright: Copyright (c) Computer Associates International, Inc.
  7. Author:          Marek Matus (marek.matus@ca.com)
  8. Product:          Tiny Firewall
  9. Description:      
  10. ///////////////////////////////////////////////////////////////////////*/
  11.  -->
  12.  
  13. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  14.         <xsl:output method="html"/>
  15.         
  16.         <!--<xsl:include href="../common/tools.xsl"/>-->
  17.         <xsl:variable name="INCLUDED_FILES">../common/tools.xsl</xsl:variable>
  18.         
  19.         <xsl:variable name="templateName" select="//Params/Param[@name='templateName']"/>
  20.         <xsl:variable name="name" select="//Params/Param[@name='name']"/>
  21.         <xsl:variable name="sid" select="//Params/Param[@name='sid']"/>
  22.         <xsl:variable name="group" select="//Params/Param[@name='group']"/>
  23.         
  24.         <xsl:template match="/">
  25.             
  26.             <xsl:choose>
  27.                 <xsl:when test="$templateName='getIPObjArray'">                    
  28.                     <xsl:call-template name="getIPObjArray"/>
  29.                 </xsl:when>
  30.                 
  31.                 <xsl:when test="$templateName='getTokensArray'">
  32.                     <xsl:call-template name="getTokensArray">
  33.                         <xsl:with-param name="sid" select="$sid"/>
  34.                         <xsl:with-param name="group" select="$group"/>
  35.                     </xsl:call-template>
  36.                 </xsl:when>
  37.                 
  38.                 <xsl:when test="$templateName='isObjNameUnique'">
  39.                     <xsl:call-template name="isObjNameUnique">
  40.                         <xsl:with-param name="name" select="$name"/>
  41.                     </xsl:call-template>
  42.                 </xsl:when>
  43.             </xsl:choose>
  44.                         
  45.         </xsl:template>
  46.         
  47.         <!-- Check if object name is unique. -->
  48.         <xsl:template name="isObjNameUnique">
  49.             <xsl:param name="name"/>
  50.             
  51.             <xsl:variable name="cnt" select="count(//Definitions/Object[@id=$name])"/>
  52.             <xsl:choose>
  53.                 <xsl:when test="$cnt=0">
  54.                     <xsl:text>true</xsl:text>
  55.                 </xsl:when>
  56.                 <xsl:otherwise>
  57.                     <xsl:text>false</xsl:text>
  58.                 </xsl:otherwise>
  59.             </xsl:choose>
  60.         </xsl:template>
  61.         
  62.         <!-- Get IP address list. -->
  63.         <xsl:template name="getIPObjArray">
  64.             <xsl:text>new Array(</xsl:text>
  65.         
  66.                 <xsl:for-each select="//Definitions/Object[@ot='ipaddress']">
  67.                     <xsl:sort select="@id"/>
  68.     
  69.                     <xsl:if test="position()>1">
  70.                         <xsl:text>,</xsl:text>
  71.                     </xsl:if>
  72.                 
  73.                     <xsl:text>'</xsl:text>
  74.                     
  75.                         <xsl:call-template name="printJSText">
  76.                             <xsl:with-param name="string" select="@id"/>
  77.                         </xsl:call-template>
  78.                     
  79.                     <xsl:text>'</xsl:text>
  80.                 </xsl:for-each>
  81.             
  82.             <xsl:text>)</xsl:text>
  83.             
  84.         </xsl:template>
  85.         
  86.         <!-- Get tokens. -->
  87.         <xsl:template name="getTokensArray">
  88.             <xsl:param name="sid"/>
  89.             <xsl:param name="group"/>
  90.             
  91.             <xsl:text>new Array(</xsl:text>
  92.             
  93.                 <xsl:for-each select="//RuleList[@name=$group]/Rule[@sid=$sid]/Token">
  94.                 
  95.                     <xsl:if test="position()>1">
  96.                         <xsl:text>,</xsl:text>
  97.                     </xsl:if>
  98.                     
  99.                     <xsl:text>new Array(</xsl:text>
  100.                         <xsl:text>'</xsl:text>
  101.                             <xsl:call-template name="printJSText">
  102.                                 <xsl:with-param name="string" select="."/>
  103.                             </xsl:call-template>
  104.                         <xsl:text>'</xsl:text>
  105.                             
  106.                         <xsl:for-each select="@*">
  107.                                                 
  108.                             <xsl:text>,'</xsl:text>
  109.                                 <xsl:call-template name="printJSText">
  110.                                     <xsl:with-param name="string" select="name()"/>
  111.                                 </xsl:call-template>
  112.                             <xsl:text>',</xsl:text>
  113.                             
  114.                             <xsl:text>'</xsl:text>
  115.                                 <xsl:call-template name="printJSText">
  116.                                     <xsl:with-param name="string" select="."/>
  117.                                 </xsl:call-template>
  118.                             <xsl:text>'</xsl:text>
  119.                         </xsl:for-each>
  120.         
  121.                     <xsl:text>)</xsl:text>
  122.                 
  123.                 </xsl:for-each>
  124.             
  125.             <xsl:text>)</xsl:text>
  126.         </xsl:template>
  127. </xsl:stylesheet>